﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.EarTag.API.Application.MediatorCommand.BreedingWeighCommand;

namespace S.EarTag.API.Controllers
{
    /// <summary>
    /// 育种称重
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BreedingWeighController : ControllerBase
    {
        private readonly IMediator _mediator;
        public BreedingWeighController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 添加育种称重
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public Task<bool> Addbreeding(AddBreedingCommand t)
        {
            return  _mediator.Send(t);
        }
        /// <summary>
        /// 修改育种称重
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public Task<bool> UpdateBreeding(UpdateBreedingCommand t)
        {
            return _mediator.Send(t);
        }
        /// <summary>
        /// 删除育种称重
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public Task<bool> DeletedBreeding(DeletedBreedingCommand t)
        {
            return _mediator.Send(t);
        }
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public Task<bool> AddAllBreedingWeigh(AddAllBreedingWeighCommand t)
        {
            return _mediator.Send(t);
        }
    }
}
